<?php
class Subcategorymanager_Model_Insertsubcategorydata implements Subcategorymanager_Model_Mainable {
    
    private $core_controller_tokenchechout;
    private $core_controller_notnull;
    
    private $excepted_result = 1;
    
    private $subcategorymanager_data_insertsubcategorysettings;
    private $subcategorymanager_data_insertsubcategorymetavalues;
    private $subcategorymanager_data_insertsubcategorycontentvalues;
    
    private $insert_subcategory_settings_result;
    private $insert_subcategory_meta_values_result;
    private $insert_subcategory_content_values_result;
    
    public function main(array $variables = null) {
        $this->core_controller_tokenchechout = new Core_Controller_Tokencheckout;
        $this->core_controller_tokenchechout->main($variables['post']);
        $this->core_controller_notnull = new Core_Controller_Notnull;
        $this->core_controller_notnull->main($variables);
        
        $this->subcategorymanager_data_insertsubcategorysettings = new Subcategorymanager_Data_Insertsubcategorysettings;
        $this->subcategorymanager_data_insertsubcategorymetavalues = new Subcategorymanager_Data_Insertsubcategorymetavalues;
        $this->subcategorymanager_data_insertsubcategorycontentvalues = new Subcategorymanager_Data_Insertsubcategorycontentvalues;
        
        $this->insert_subcategory_settings_result = $this->subcategorymanager_data_insertsubcategorysettings->main($variables);
        $this->insert_subcategory_meta_values_result = $this->subcategorymanager_data_insertsubcategorymetavalues->main($variables);
        $this->insert_subcategory_content_values_result = $this->subcategorymanager_data_insertsubcategorycontentvalues->main($variables);
        
        if(
                ($this->insert_subcategory_settings_result == $this->excepted_result) &&
                ($this->subcategorymanager_data_insertsubcategorymetavalues == $this->excepted_result) &&
                ($this->subcategorymanager_data_insertsubcategorycontentvalues = $this->excepted_result)
                ){
            header("Location: ".SITE_ROOT."zarzadzaj-podkategoriami.html");
        }
        else {
            header("Location: ".SITE_ROOT."zarzadzaj-podkategoriami.html");
        }
    }

}

